  <!DOCTYPE html>
  <html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Title</title>
  </head>
  <body>
  <canvas id="c1" width="600" height="400" style="width: 600px; height: 400px;"></canvas>
  <script>
    // 画布
    const canvas = document.getElementById('c1')
    // 画笔
    const ctx = canvas.getContext('2d')
    let img = new Image()
    img.src = './img/csgo.png'
    img.onload = function () {
      let patten = ctx.createPattern(img,"repeat")
      ctx.fillStyle = patten;
      ctx.rect(0,0,600,400)
      ctx.fill()
    }
  </script>
  </body>
  </html>